#include<iostream>

using namespace std;
/*
class A{
  public:
    virtual void Func1(){
      cout<<"A::Func1()"<<endl;
    }

    virtual void Func2(){
      cout<<"A::Func2()"<<endl;
    }
    int _a = 10;
};

class B:public A{
  public:
    virtual void Func1(){
      cout<<"B::Func1()"<<endl;
    }

    virtual void Func3(){
      cout<<"B::Func3()"<<endl;
    }

    int _b = 20;
};

typedef void(*VFPTR)();
void PrintVT( VFPTR vTable[] ,size_t n){
  cout<<"ptr: "<< vTable <<endl;
  for(size_t i = 0;i<n;++i){
    printf(" 第%u地址:0x%x,->",i,vTable[i]);
    VFPTR f=vTable[i];
    f();
  }
  cout<<endl;
}

void test1(){

  A aa;
  B bb;
  PrintVT(*(VFPTR**)&aa,2);
  PrintVT(*(VFPTR**)&bb,3);

}
*/

/////////////////////// 

class A{
  public:
    virtual void Func1(){
      cout<<"A::Func1()"<<endl;
    }
    virtual void Func2(){
      cout<<"A::Func2()"<<endl;
    }
};


class B{
  public:
    virtual void Func1(){
      cout<<"B::Func1()"<<endl;
    }
    virtual void Func2(){
      cout<<"B::Func2()"<<endl;
    }
};

class C : public A,public B{
  public:
    virtual void Func1(){
      cout<<"C::Func1()"<<endl;
    }
    virtual void Func3(){
      cout<<"C::Func3()"<<endl;
    }
};

typedef void(*VFPTR)();
void PrintVT( VFPTR vTable[] ,size_t n){
  cout<<"ptr: "<< vTable <<endl;
  for(size_t i = 0;i<n;++i){
    printf(" 第%u地址:0x%x,->",i,vTable[i]);
    VFPTR f=vTable[i];
    f();
  }
  cout<<endl;
}

void test2(){
  A aa;
  B bb;
  C cc;
  PrintVT(*(VFPTR**)&aa,2);
  PrintVT(*(VFPTR**)&bb,2);
  PrintVT(*(VFPTR**)&cc,5);

}

int main()
{

//test1();

  test2();

  return 0;
}
